package exception;

public class TryCatchDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        try {
            String l = null;
            System.out.println(l.length());
            String len = "";
            System.out.println(len.charAt(0));
            String len1 = "abc";
            System.out.println(Integer.parseInt(len1));
        }catch (NullPointerException e){
            e.printStackTrace();
            System.out.println("空指针异常");
        }catch (Exception e){
             e.printStackTrace();
            System.out.println("出现了异常");
        }

        System.out.println("程序结束");
    }
}
